import axios from '@/utils/axios';

export const getSpuPage = (params) => {
    return axios.request({
        url: '/spu/page',
        method: 'get',
        params
    });
};

export const getSpuNewPage = (data) => {
    return axios.request({
        url: '/spu/pageNew',
        method: 'post',
        data
    });
};

export const getSpuTagList = (params) => {
    return axios.request({
        url: '/spu/tag/list',
        method: 'get',
        params
    });
};

export const getSeriesList = (params) => {
    return axios.request({
        url: '/series/list',
        method: 'get',
        params
    });
};

export const updateSpuPublish = (data) => {
    return axios.request({
        url: '/spu/publish',
        method: 'put',
        data
    });
};

export const batchModifyVirtualSalesQty = (data) => {
    return axios.request({
        url: '/spu/virtual/sales-qty/settings',
        method: 'put',
        data
    });
};

export const batchModifySellPrice = (data) => {
    return axios.request({
        url: '/spu/sell-price/settings',
        method: 'put',
        data
    });
};

export const batchModifyVirtualSalesPrice = (data) => {
    return axios.request({
        url: '/spu/virtual/sell-price/settings',
        method: 'put',
        data
    });
};

export const batchModifySpuTags = (data) => {
    return axios.request({
        url: '/spu/tag/settings',
        method: 'put',
        data
    });
};

export const getSpuDetail = (siteId, spuId) => {
    return axios.request({
        url: '/spu/' + siteId + '/' + spuId,
        method: 'get'
    });
};

export const modifySpuInformation = (data) => {
    return axios.request({
        url: '/spu/settings',
        method: 'put',
        data
    });
};

export const getPmsSkuList = (siteId, spuId) => {
    return axios.request({
        url: '/spu/' + siteId + '/' + spuId + '/sku/list',
        method: 'get'
    });
};

export const delSkuDetail = (siteId, skuId) => {
    return axios.request({
        url: '/spu/' + siteId + '/sku/' + skuId,
        method: 'delete'
    });
};

// 设置首图
export const setTopImage = (data) => {
    return axios.request({
        url: '/spu/image',
        method: 'put',
        data
    });
};
// 独立站上传商品图片
export const addNewSpuImage = (data) => {
    return axios.request({
        url: '/spu/addNewSpuImage',
        method: 'post',
        data
    });
};
// 删除
export const deleteSiteSpuImage = (siteId, imageId) => {
    return axios.request({
        url: `/spu/deleteSiteSpuImage/${siteId}/${imageId}`,
        method: 'delete'
    });
};

// 不分页获取商品信息
export const getSpuAllPage = (data) => {
    return axios.request({
        url: '/spu/noPage',
        method: 'post',
        data
    });
};

// 删除商品
export const batchDelGoods = (data) => {
    return axios.request({
        url: '/spu/import',
        method: 'delete',
        data
    });
};

// 新增商品
export const addSpu = (data) => {
    return axios.request({
        url: '/spu',
        method: 'post',
        data
    });
};
